<%@page language="java" import="com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransaction,
                                com.scalar.chiptrack.utils.StringUtils,
                                com.scalar.chiptrack.finance.purchaseorder.PurchaseOrderLineItemList,
                                com.scalar.chiptrack.finance.purchaseorder.PurchaseOrderLineItem,
                                java.util.Iterator,
                                java.util.HashMap" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<% int i = 0; /*variable used to assign numers to marketing part number drop down*/%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html:html>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<chiptrack:checkLogon sourcePage="/jsp/finance/confirm_receivings_transaction_entry.jsp"/>

<META http-equiv='Content-Type' content='text/html; charset=windows-1252'>
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>
<SCRIPT language='JavaScript'>

function loadPurchasingLotNumberEntry(poNumber,poSeqNumber,i)
{
    var form = document.receivingsTransactionForm;


        var vendorNumber	= form['receivingsTransaction.vendorId'].value;
		var queryString = "<%=chipTracContext%>/purchaseOrderLotAction.do?action=poLotsModify&poNumber="+ poNumber +"&poSeqNumber=" + poSeqNumber +"&vendorNumber="+ vendorNumber;
		newWindow = window.open ( queryString, 'optionsPopup', 'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=750,height=380,left=150,top=100,resizable=yes' );
		newWindow.focus();

}


</SCRIPT>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0'>
<!-- Top Header Start-->

<%@include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<p>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

<%@include file="/jsp/finance/purchase_order_menu.jsp" %>

</TD>
<!-- end of the side navigations -->

<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<!-- SiteMap Tag >
< c h i p t r a c k : s i t e m a p   s t y l e C l a s s = " N A r i a l S " / -->

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->
			<P>

			<TABLE BORDER="0" WIDTH="100%">

				<TR>
					<TD WIDTH="100%">
            <html:form name="receivingsTransactionForm" action="/autoReceivingAndInvoice.do" method="post" type="com.scalar.chiptrack.finance.purchaseorder.forms.ReceivingsTransactionForm">

            <TABLE BORDER="0" WIDTH="100%" HEIGHT="175%">
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="100%">
							<TR>
								<TD WIDTH="100%" class="NArialW">
									<P ALIGN="CENTER">View Auto Receipt
                                </TD>
							</TR>
						</TABLE>
                        <BR>
						<BR>
                        <nested:nest property="receivingsTransaction">
						<TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
							<TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<TD WIDTH="20%">Receipt Number:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="18%">
                                    <nested:write property="receiptNumber" />
                                    <nested:define property="receiptNumber" id="receiptNumberString" />
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="15%">Type:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="36%">
                                    Shipment/Invoice
                                </TD>
                        		<TD WIDTH="5%">&nbsp;</TD>
							</TR>
							<TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<TD WIDTH="20%">Reference No:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="18%">
                                    <nested:write property="vendorDocNumber" />
								</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="15%">Receipt Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="36%">
									<nested:write property="receiptDate" />
								</TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
                            <TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<TD WIDTH="20%">Vendor Name:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="18%">
                                    <nested:write property="vendorName" />
                                    <nested:hidden property="vendorId" />
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="15%"></TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="36%">&nbsp;</TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
							<TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<TD WIDTH="20%">&nbsp;</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="18%">&nbsp;</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="15%">&nbsp;</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="36%">&nbsp;</TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
						</TABLE>
                        <BR>
						<BR>
                        <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
							<TR>
								<TD WIDTH="4%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER">&nbsp;<FONT COLOR="white">S.No</FONT>
								</TD>
                                <TD WIDTH="9%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">PO Number</FONT>
								</TD>
								<TD WIDTH="9%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Part Number</FONT>
								</TD>
								<TD WIDTH="9%" HEIGHT="26" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Vendor Part Number</FONT>
								</TD>
                                <TD WIDTH="15%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Description</FONT>
								</TD>
                                <!--TD WIDTH="7%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Site</FONT>
								</TD-->
								<TD WIDTH="7%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Shipped</FONT>
								</TD>
								<TD WIDTH="7%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Ordered</FONT>
								</TD>
                                <TD WIDTH="7%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Cancelled</FONT>
								</TD>
                                <TD WIDTH="7%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Invoiced</FONT>
								</TD>
								<TD WIDTH="7%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Unit Cost</FONT>
								</TD>
								<TD WIDTH="7%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Extended Cost</FONT>
								</TD>
                                <TD WIDTH="6%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Previous Shipped</FONT>
								</TD>
                                <TD WIDTH="6%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Previous Invoiced</FONT>
								</TD>
							</TR>
                            <nested:iterate property="receivingsTransactionLineItemList" type="com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransactionLineItem" >
							<TR>
								<TD WIDTH="4%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<P ALIGN="CENTER">&nbsp;
                                    <nested:write property="receiptIndex" />

                                    <!-- Hidden field stores the no of Line items available for a Purchase Order -->
                                    <nested:hidden property="lineItemCount" />
								</TD>
                                <TD WIDTH="9%" ALIGN="LEFT" BGCOLOR="#DEE1E2">
									<P>
                                    <bean:define id="index" value="0"/>
                                    <nested:write property="poNumber" />
								</TD>
								<TD WIDTH="9%" ALIGN="LEFT" BGCOLOR="#DEE1E2" nowrap>
									<P>
                                    <nested:write property="manufacturingPartNoLabel" />
								</TD>
								<TD WIDTH="9%" ALIGN="LEFT" BGCOLOR="#DEE1E2" nowrap>
									<P>
                                    <nested:write property="marketingPartNo" />
								</TD>
                                <TD WIDTH="15%" ALIGN="LEFT" BGCOLOR="#DEE1E2">
									<P><nested:write property="lineItemDescription" />
								</TD>
                                <!--TD WIDTH="7%" ALIGN="CENTER" BGCOLOR="#DEE1E2" nowrap>
									<CENTER>
									<P>
                                    <!--nested:write property="siteId" />
                                    </CENTER>
								</TD-->
                                <TD WIDTH="7%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:write property="quantityShipped" />
                                    <a href="javascript:loadPurchasingLotNumberEntry('<bean:write name="receiptNumberString" />','<nested:write property="receivingsTransactionLineItemSequenceNo"/>','<%=i%>')" onmouseover="window.status='Click To add Purchasing Lot Number Entry Details';return true" onmouseout="window.status='';return true">View</a>
                                    </CENTER>
								</TD>
								<TD WIDTH="7%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:write property="quantityOrdered" />
                                    </CENTER>
								</TD>
                                <TD WIDTH="7%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:write property="quantityCancelled" />
                                    </CENTER>
								</TD>
                                <TD WIDTH="7%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:write property="quantityInvoiced" />
                                    </CENTER>
								</TD>
								<TD WIDTH="7%" ALIGN="RIGHT" BGCOLOR="#DEE1E2">
									<P>$<nested:write property="unitCost" />
									<!--nested:write property="unitCostAsString" /-->
								</TD>
								<TD WIDTH="7%" ALIGN="RIGHT" BGCOLOR="#DEE1E2">
									<P>$<nested:write property="extendedCost" />
								</TD>
                                <TD WIDTH="6%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:write property="previousShipped" />
                                    </CENTER>
								</TD>
                                <TD WIDTH="6%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:write property="previousInvoiced" />
                                    </CENTER>
								</TD>
							</TR>
                            <% i++; %>
                            </nested:iterate>
                            <TR>
								<TD WIDTH="74%" COLSPAN="10" ALIGN="RIGHT" VALIGN="TOP">
									<TABLE BORDER="0" WIDTH="100%" CLASS="NArialL"  CELLSPACING="2" CELLSPACING="2">
                                        <TR>
                                            <TD ALIGN="RIGHT">Subtotal:&nbsp;&nbsp;</TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT" >Trade Discount:&nbsp;&nbsp;</TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT">Freight:&nbsp;&nbsp;</TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT">Miscellaneous:&nbsp;&nbsp;</TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT">Tax:&nbsp;&nbsp;</TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT">Total:&nbsp;&nbsp;</TD>
                                        </TR>
                                        <TR>
                                            <TD WIDTH="100%" colspan="6">&nbsp;</TD>
                                        </TR>
                                    </TABLE>
								</TD>
								<TD WIDTH="7%" ALIGN="CENTER" VALIGN="TOP">
									<TABLE VALIGN="TOP" BORDER="0" WIDTH="100%" CLASS="NArialL"  CELLSPACING="2" CELLSPACING="1">
                                        <TR>
                                            <TD ALIGN="RIGHT" bgcolor="#DEE1E2">$<nested:write property="subTotal" />
                                            </TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT" bgcolor="#DEE1E2">&nbsp;
                                                $<nested:write property="tradeDiscount" />
                                            </TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT" bgcolor="#DEE1E2">&nbsp;
                                                $<nested:write property="freight" />
                                            </TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT" bgcolor="#DEE1E2">&nbsp;
                                                $<nested:write property="miscellaneous" />
                                            </TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT" bgcolor="#DEE1E2">&nbsp;
                                                $<nested:write property="tax" />
                                            </TD>
                                        </TR>
                                        <TR>
                                            <TD ALIGN="RIGHT" bgcolor="#DEE1E2">$<nested:write property="total" />
                                            </TD>
                                        </TR>
                                        <TR>
                                            <TD colspan="6">&nbsp;</TD>
                                        </TR>
								    </TABLE>
								</TD>
                                <TD WIDTH="12%" COLSPAN="2">&nbsp;</TD>
							</TR>
                        </TABLE>
					<BR>
					</TD>
				</TR>
			</TABLE>
           </nested:nest>
           <input type= "hidden" name = "count" value="<%=i%>">
           </html:form>

					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="100%">
							<TR>
								<TD WIDTH="50%">&nbsp;
                                    <%--Commented by Krishna Prasad, save button does not require in view page--%>
                                    <%--<P ALIGN="right"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" ALIGN="BOTTOM" BORDER="0">--%>
                                </TD>
								<TD WIDTH="50%"><P ALIGN="left"><A href="autoReceivingAndInvoice.do" onmouseover="window.status='Click here to go back Auto Invoice Transaction Search';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/cancel.gif" ALIGN="BOTTOM" BORDER="0"></A></TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
			</TABLE>
<!-- Your Work area ends here -->
		</TD>
		<TD BGCOLOR="white"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALIGN="BOTTOM" BORDER="0"></TD>
	</TR>
</TBODY></TABLE>

<!-- Footer starts here -->

<%@include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->
</BODY>
</html:html>